import axios from '../axios'

// 获取活动列表示例
export const getActivityList = (params) => {
  return axios.get('/api/getActivityList', { params })
}

// 获取活动详情示例
export const getActivityDetail = (id) => {
  return axios.get(`/api/getActivity/${id}`)
}

// 创建新活动示例
export const createActivity = (data) => {
  return axios.post('/api/createActivity', data)
}

// 使用示例：
/*
// 在组件中使用:
import { getActivityList, getActivityDetail, createActivity } from '@/api/activity'

// GET请求示例
async function fetchActivities() {
  try {
    const params = {
      page: 1,
      pageSize: 10
    }
    const response = await getActivityList(params)
    console.log('活动列表:', response.data)
  } catch (error) {
    console.error('获取活动列表失败:', error)
  }
}

// GET请求带路径参数示例
async function fetchActivityDetail(id) {
  try {
    const response = await getActivityDetail(id)
    console.log('活动详情:', response.data)
  } catch (error) {
    console.error('获取活动详情失败:', error)
  }
}

// POST请求示例
async function addNewActivity() {
  try {
    const activityData = {
      title: '新活动',
      description: '活动描述',
      startTime: '2024-01-01',
      endTime: '2024-01-02'
    }
    const response = await createActivity(activityData)
    console.log('创建活动成功:', response.data)
  } catch (error) {
    console.error('创建活动失败:', error)
  }
}
*/
